type op = Add | Sub | Mult | Div | Equal | Neq | Less | Leq | Greater | Geq | 
And | Or | Mod

type typ = Node | Int | Flt | Str | Edg
type edg =  Ledge | Redge | Uedge
type paren = Rparen | Lparen
type dir = In | Out
type ruleProp = Dolr | Tilde

type variable =
	VarId of string
(* all recvars are attributes! *)
|	RecVar of variable * string
|	ArrayIndDyn of string * variable
|	ArrayIndStat of string * int

(* these are for inside connection contexts ONLY *)
type tree = Leaf of int | SubTree of int * edg * tree list

type expr =
	Lit_Flt of float
| 	Lit_Str of string
| 	Lit_Int of int
|	Variable of variable
|	Binop of expr * op * expr
|	Actuals of expr list 
| 	NodeInEdge of variable * expr
|  	NodeOutEdge of variable * expr
| 	NodeInEdges of variable
| 	NodeOutEdges of variable
| 	EdgeInNode of variable
|  	EdgeOutNode of variable
|	NodeChild of variable * expr
|	NodeParent of variable * expr	


type conObj =
	Lit_Int_Con of int
|	Edge of edg
|	Paren of paren

type addByType = AddByNode | AddByEdge

type stmt =                             
  	Expr of expr				
|	EdgeCreation of variable * edg * variable
| 	Declare_Only of typ * variable		
| 	Declare of typ * variable * expr	
|	Call of string * expr list	
| 	CallRule
|	Crawl of string * expr list * variable * string 
|	CreateGraph of variable * tree
|	Print of expr list
| 	If of expr * stmt list * stmt list
| 	While of expr * stmt list
|	Assign of variable * expr
|	SetRule of string
|	RAdd  of variable
|	RAddFront of variable
|	RAddBy of string * addByType * ruleProp * int
|	RAddByFront of string * addByType * ruleProp * int

type formal =
	Validate of dir * typ * string

type func_decl = {
	func_type : string;
        fname : string;
        formals : formal list; 
        body : stmt list;
}

type program = func_decl list 
